package com.yawn.restclient.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author yawn
 * @date 2018-05-06 13:32
 */
@RestController
public class ClientController {

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/rest")
    public Object test1() {
        ResponseEntity<String> entity =
                restTemplate.getForEntity("http://127.0.0.1:8090/test1", String.class);
        String body = entity.getBody();
        System.out.println(body);
        return entity;
    }
}
